using Sandia.MVCFramework.Request;
using System;
using System.Collections.Generic;
using System.Text;

namespace Sandia.MVCFramework.Common
{
    /// <summary>
    /// Interface to be implemented by classes that route requests
    /// </summary>
    /// <remarks>Implemented by Controller</remarks>
    public interface IRequestRouter
    {
        /// <summary>
        /// Route a specified request (asynchronously)
        /// </summary>
        /// <param name="request">The request to route.</param>
        void RouteRequest(
            IRequest request);

        /// <summary>
        /// Route a specified request synchronously
        /// </summary>
        /// <param name="request">The request to route.</param>
        void RouteRequestSynchronously(
            IRequest request);

        /// <summary>
        /// Adds a request processor to the list of processors
        /// for a specified request
        /// </summary>
        /// <param name="requestType">The request type to trigger on</param>
        /// <param name="requestProcessor">The processor for the specified request type</param>
        void AddRequestRouting(
            Type requestType,
            IRequestProcessor requestProcessor);

        /// <summary>
        /// Removes a request processor from the list of processors
        /// for a specified request
        /// </summary>
        /// <param name="requestType">The request type to remove from</param>
        /// <param name="requestProcessor">The processor to remove</param>
        void RemoveRequestRouting(
            Type requestType,
            IRequestProcessor requestProcessor);
    }
}